Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C Rust #3

Merged
merged 17 commits into from
Aug 6, 2024
Merged

I2C Rust #3

merged 17 commits into from
Aug 6, 2024

Conversation

lvyuemeng
Copy link
Collaborator

No description provided.

@lvyuemeng lvyuemeng added enhancement New feature or request help wanted Extra attention is needed labels Aug 2, 2024
bcm2835_rust: continue Add functions
Caution: the problem of dev.msg_buf and curr_msg.buf is needed to be reconciled

i2c: Add basic structure for ffi bindings.
Signed-off-by: Nostalgia <[email protected]>
bcm2835_rust: continue Add functions
Caution: the problem of dev.msg_buf and curr_msg.buf, we need to consruct a elegant way for a replacement of ptr++ .

Signed-off-by: Nostalgia <[email protected]>
bcm2835_rust: continue Add functions
Caution: the problem of dev.msg_buf and curr_msg.buf, we need to consruct a elegant way for a replacement of ptr++ .

Signed-off-by: Nostalgia <[email protected]>
Add bcm2835_i2c_xfer
Add Error: EREMOTEIO
Add bcm2835_i2c_func

Signed-off-by: Nostalgia <[email protected]>
Add bcm2835_i2c_xfer
Add Error: EREMOTEIO
Add bcm2835_i2c_func

Signed-off-by: Nostalgia <[email protected]>
bcm2835_rust: 部分修正,尝试填充probe函数。
i2c mod: 添加i2c_quirks。

Signed-off-by: Nostalgia <[email protected]>
bcm2835_rust: 部分修正,尝试填充probe函数。
i2c mod: 添加i2c_bcm2835quirks。
device, platform, clk.

Signed-off-by: Nostalgia <[email protected]>
bcm2835_rust: 部分修正,尝试填充probe函数。
i2c mod: 添加i2c_bcm2835quirks。
device, platform, clk.

Signed-off-by: Nostalgia <[email protected]>
bcm2835_rust: 部分修正,尝试填充probe函数。
i2c mod: 添加i2c_bcm2835quirks。
device, platform, clk.

Signed-off-by: Nostalgia <[email protected]>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以看下 platform.rs 里 Adapter 的 register 和 probe_callback 方法,利用它们也许可以自动将 i2c_adapter 要干的活做了,至少能做一部分

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我建议检查一下我之前的提交有没有出现修改c文件的情况,如果有就回滚一下,我怕我误操作了

@@ -54,7 +54,7 @@ pub mod init;
pub mod io_buffer;
pub mod io_mem;
#[cfg(CONFIG_IOMMU_IO_PGTABLE)]
pub mod io_pgtable;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么注释掉了呢?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我这里显示找不到相关mod 可能又是无意间修改了什么不知道的 (悲)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里这个mod已经被上一行的cfg条件屏蔽掉了,不会引入并编译,不需要再注释了
可能是之前仓库遗留的一些东西

pub fn kmalloc<T>(&self) -> Result<*mut T> {
let size = core::mem::size_of::<T>();
let ptr = unsafe {
bindings::devm_kmalloc(self.ptr, size, bindings::GFP_KERNEL | bindings::__GFP_ZERO)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devm_kmalloc这里第3个参数应该要从外部传入

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

第三个参数是bindings里的,这里怎么做好?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GFP的宏定义大多已经binding出来了,可以直接用。不过鉴于这个devm_kmalloc似乎没有什么地方用到,可以先不用封装它

lvyuemeng and others added 4 commits August 5, 2024 10:46
bcm2835_rust: 部分修正,尝试填充probe函数。
i2c mod: 添加i2c_bcm2835quirks。
device, platform, clk.

Signed-off-by: Nostalgia <[email protected]>
修正函数中数值及类型部分

Signed-off-by: Nostalgia <[email protected]>
修正函数中数值及类型部分,及所有权部分。

Signed-off-by: Nostalgia <[email protected]>
@creatoy creatoy merged commit 04bbe14 into rpi-6.6.y Aug 6, 2024
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants